﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GUI
{
	public partial class ToolBox : UserControl
	{
		public enum EditMode { Select = 1, Bomb, Start, Clean };

		Bitmap arrowOff = global::GUI.Properties.Resources.arrow;
		Bitmap cleanOff = global::GUI.Properties.Resources.clean;
		Bitmap bombOff = global::GUI.Properties.Resources.bomb;
		Bitmap startOff = global::GUI.Properties.Resources.startingPoint;
		Bitmap arrowOn = global::GUI.Properties.Resources.arrowOn;
		Bitmap cleanOn = global::GUI.Properties.Resources.cleanOn;
		Bitmap bombOn = global::GUI.Properties.Resources.bombOn;
		Bitmap startOn = global::GUI.Properties.Resources.startingPointOn;

		private EditMode _mode;

		public EditMode Mode
		{
			get
			{
				return _mode;
			}
		}

		public ToolBox()
		{
			InitializeComponent();

			arrowButton.Enabled = false;
			_mode = EditMode.Select;


		}

		private void arrowButton_Click(object sender, EventArgs e)
		{
			setAllButtonsUp();
			arrowButton.Enabled = false;
			this._mode = EditMode.Select;
			this.arrowButton.BackgroundImage = arrowOn;
		}

		private void destroyButton_Click(object sender, EventArgs e)
		{
			setAllButtonsUp();
			destroyButton.Enabled = false;
			this._mode = EditMode.Bomb;
			this.destroyButton.BackgroundImage = bombOn;
		}

		private void startButton_Click(object sender, EventArgs e)
		{
			setAllButtonsUp();
			startButton.Enabled = false;
			this._mode = EditMode.Start;
			this.startButton.BackgroundImage = startOn;
		}

		private void cleanButton_Click(object sender, EventArgs e)
		{
			setAllButtonsUp();
			cleanButton.Enabled = false;
			this._mode = EditMode.Clean;
			this.cleanButton.BackgroundImage = cleanOn;
		}

		private void setAllButtonsUp()
		{
			this.arrowButton.Enabled = true;
			this.arrowButton.BackgroundImage = arrowOff;
			this.destroyButton.Enabled = true;
			this.destroyButton.BackgroundImage = bombOff;
			this.startButton.Enabled = true;
			this.startButton.BackgroundImage = startOff;
			this.cleanButton.Enabled = true;
			this.cleanButton.BackgroundImage = cleanOff;
		}
	}
}
